package com.sc.nft.hna.form;

import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.sc.nft.config.hna.HnaConfig;
import lombok.Data;

import java.util.Map;

@Data
public class Q001TransForm extends BaseTransForm {

  public static final String[] encryptArr = new String[] {"userId"};
  public static final String[] verifyArr =
      new String[] {
        "version",
        "tranCode",
        "merOrderId",
        "merId",
        "charset",
        "signType",
        "resultCode",
        "errorCode",
        "userId",
        "outUserId",
        "userStat",
        "auditStat",
        "balAmount",
        "bindCardAgrNoList"
      };
  public static final String[] submitArr =
      new String[] {
        "version",
        "tranCode",
        "merId",
        "merOrderId",
        "submitTime",
        "msgCiphertext",
        "signType",
        "signValue",
        "merAttach",
        "charset"
      };
  private static final long serialVersionUID = 670264593585813480L;

  public static final String MAIN_URL = "https://ncount.hnapay.com/api/q001.htm";
  public static final String TRAN_CODE = "Q001";
  private String userId; // 用户编号

  @Override
  public String getEncryptJsonStr() {
    return getJsonStr(this, encryptArr);
  }

  @Override
  public String getVerifyJsonStr() {
    return getJsonStr(this, verifyArr);
  }

  @Override
  public String getSubmitJsonStr() {
    return getJsonStr(this, submitArr);
  }

  public static Map<String, Object> generateParam(HnaConfig hnaConfig, String userId) {
    Q001TransForm transForm = new Q001TransForm();
    transForm.initCommonParams(TRAN_CODE, hnaConfig.getMerId(), IdWorker.getIdStr(), "");
    transForm.setUserId(userId);
    return generateParam(transForm, hnaConfig);
  }
}
